<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分类</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css">
</head>
<body class="bg3">
<!--导航-->
<div id="pjax-container">
    <nav th:replace="_fragments :: menu(2)" class="ui inverted attached segment m-shadow-small"></nav>
    <!--中间-->
    <div class="m-container m-padded-tb-big">
        <div class="ui animated fadeIn container">
            <!--        header-->
            <div class="ui top white-transform attached segment" style="border: 0">
                <div class="ui middle aligned two column grid">
                    <div class="column">
                        <h2 class="ui header" style="color: #ece2ff">Types</h2>
                    </div>
                    <div class="right aligned column">
                        <div class="ui header m-inline-block" style="color: #ffe9f9">共
                            <h2 class="ui header m-inline-block" style="color: #d6fff7" th:text="${#arrays.length(types)}">2</h2>个
                        </div>
                    </div>
                </div>
            </div>
            <!--        放置分类栏-->
            <div class="ui attached grey white-transform segment m-padded-tb-large" style="border: 0">
                <div class="ui blue-transform labeled button m-margin-top-small m-margin-lf-small"
                     th:each="type : ${types}">
                    <a href="#" th:href="@{/types/{id}(id=${type.id})}" class="ui basic button"
                       th:classappend="${type.id==activeTypeId} ? 'black'" th:text="${type.name}">
                        类型</a>
                </div>
            </div>
            <!--        列出分类文章-->
            <div class="ui attached white-transform segment" style="border: 0">
                <div class="ui padded vertical segment m-padded-tb" th:each="blog : ${pageInfo.list}">
                    <div class="ui mobile reversed stackable grid">
                        <div class="eleven wide column">
                            <h3 class="ui header"><a href="#" class="m-black" target="_blank"
                                                     th:href="@{/blog/{id}(id=${blog.id})}" th:text="${blog.title}">浮躁时代的一点纯真</a>
                            </h3>
                            <br>
                            <p><a href="#" class="m-black" target="_blank" th:href="@{/blog/{id}(id=${blog.id})}"
                                  th:text="${blog.description}">在十多年前的那个夜晚，星星闪烁着金黄色的微光</a></p>
                            <div class="ui grid m-padded-bottom-mini">
                                <div class="eleven wide column">
                                    <div class="ui horizontal link list mini">
                                        <div class="item">
                                            <img src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=4195665098,552692922&fm=26&gp=0.jpg"
                                                 th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image">
                                            <div class="content"><a href="#" class="header"
                                                                    th:text="${blog.user.nickname}">京</a>
                                            </div>
                                        </div>
                                        <div class="item">
                                            <i class="calendar icon"></i><span class="ui middle aligned"
                                                                               th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')}">2021-1-17</span>
                                        </div>
                                        <div class="item">
                                            <i class="eye icon"></i><span class="ui middle aligned"
                                                                          th:text="${blog.views}">1111</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="right aligned four wide column">
                                    <a href="#" th:href="@{/types/{id}(id=${blog.type.id})}" target="_blank"
                                       class="ui gray label m-padded-tb-small" th:text="${blog.type.name}">分类</a>
                                </div>
                            </div>
                        </div>
                        <div class="five wide column">
                            <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                <img src="https://images.unsplash.com/photo-1610990275491-54fc65bb732f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=925&q=80"
                                     th:src="@{${blog.firstPicture}}" alt="" class="ui rounded image">
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <!--                中间底部-->

            <div class="ui bottom white-transform attached segment" style="border: 0">
                <div class="ui inverted divided stackable grid">
                    <div class="two wide column" align="center">
                        <div class="item"><a class="m-black" th:href="@{'/types/'+${id}}">首页</a></div>
                    </div>
                    <div class="two wide column" align="center">
                        <div class="item"><a class="m-black"
                                            th:href="@{'/types/'+${id}(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}">上一页</a>
                        </div>
                    </div>

                    <div class="eight wide m-text-thin column" align="center">
                        <style>p{display: inline;}</style>
                        <p style="color:#ff0028;">第</p> <span style="color:#ff661e;" th:text="${pageInfo.pageNum}"></span> <p style="color: #fff74f">页~</p><p style="color: #bcff20">共<span
                            style="color: #76ffc8" th:text="${pageInfo.pages}"></span><p style="color: #cae7ff">页</p><p style="color: #7ad2ff">~有</p> <span
                            style="color: #7becff" th:text="${pageInfo.total}"></span> <p style="color: #685dff">篇</p><p style="color: #ca77ff">文</p><p style="color: #ffb7f2">章</p>
                    </div>

                    <div class="two wide column" align="center">
                        <div class="item"><a class="m-black"
                                             th:href="@{'/types/'+${id}(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}">下一页</a>
                        </div>
                    </div>
                    <div class="two wide column" align="center">
                        <div class="item"><a class="m-black" th:href="@{'/types/'+${id}(pageNum=${pageInfo.pages})}">尾页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<footer th:replace="_fragments :: footer" class="ui inverted vertical segment m-padded-tb-massive"></footer>
<!--/*/<th:block th:replace="_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<!--/*/</th:block>/*/-->
<!--利用jQuery获取到菜单-->
<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });
    $(function () {
        $(document).pjax('a[target!="_blank"]', '#pjax-container', {
            fragment: '#pjax-container',
            timeout: 8000,
            type: 'GET'
        });

        $(document).on('submit', 'form', function (event) {
            //var container = $(this).closest('[pjax-container]');
            $.pjax.submit(event, '#pjax-container', {
                fragment: '#pjax-container', timeout: 8000
            });
        });
        //
        // $(document).on('pjax:send', function () {
        //     $(".loading").css("display", "block");
        // });
        //
        // $(document).on('pjax:complete', function () {
        //     $(".loading").css("display", "none");
        // });
    })

</script>
</body>
</html>